Optimal. Leaf size=82 \[ \frac {\left (a^2-b^2\right ) x}{\left (a^2+b^2\right )^2}+\frac {2 a b \log (a \cos (c+d x)+b \sin (c+d x))}{\left (a^2+b^2\right )^2 d}-\frac {b}{\left (a^2+b^2\right ) d (a+b \tan (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.06, antiderivative size = 82, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 3, integrand size = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3564, 3612,
3611} \begin {gather*} -\frac {b}{d \left (a^2+b^2\right ) (a+b \tan (c+d x))}+\frac {2 a b \log (a \cos (c+d x)+b \sin (c+d x))}{d \left (a^2+b^2\right )^2}+\frac {x \left (a^2-b^2\right )}{\left (a^2+b^2\right )^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3564
Rule 3611
Rule 3612
Rubi steps
\begin {align*} \int \frac {1}{(a+b \tan (c+d x))^2} \, dx &=-\frac {b}{\left (a^2+b^2\right ) d (a+b \tan (c+d x))}+\frac {\int \frac {a-b \tan (c+d x)}{a+b \tan (c+d x)} \, dx}{a^2+b^2}\\ &=\frac {\left (a^2-b^2\right ) x}{\left (a^2+b^2\right )^2}-\frac {b}{\left (a^2+b^2\right ) d (a+b \tan (c+d x))}+\frac {(2 a b) \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)} \, dx}{\left (a^2+b^2\right )^2}\\ &=\frac {\left (a^2-b^2\right ) x}{\left (a^2+b^2\right )^2}+\frac {2 a b \log (a \cos (c+d x)+b \sin (c+d x))}{\left (a^2+b^2\right )^2 d}-\frac {b}{\left (a^2+b^2\right ) d (a+b \tan (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 1.36, size = 106, normalized size = 1.29 \begin {gather*} \frac {-\frac {i \log (i-\tan (c+d x))}{(a+i b)^2}+\frac {i \log (i+\tan (c+d x))}{(a-i b)^2}+\frac {2 b \left (2 a \log (a+b \tan (c+d x))-\frac {a^2+b^2}{a+b \tan (c+d x)}\right )}{\left (a^2+b^2\right )^2}}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.10, size = 97, normalized size = 1.18
method | result | size |
derivativedivides | \(\frac {\frac {-a b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )+\left (a^{2}-b^{2}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}-\frac {b}{\left (a^{2}+b^{2}\right ) \left (a +b \tan \left (d x +c \right )\right )}+\frac {2 a b \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}}{d}\) | \(97\) |
default | \(\frac {\frac {-a b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )+\left (a^{2}-b^{2}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}-\frac {b}{\left (a^{2}+b^{2}\right ) \left (a +b \tan \left (d x +c \right )\right )}+\frac {2 a b \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}}{d}\) | \(97\) |
norman | \(\frac {\frac {\left (a^{2}-b^{2}\right ) a x}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {b \left (a^{2}-b^{2}\right ) x \tan \left (d x +c \right )}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {b^{2} \tan \left (d x +c \right )}{a \left (a^{2}+b^{2}\right ) d}}{a +b \tan \left (d x +c \right )}-\frac {a b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {2 a b \ln \left (a +b \tan \left (d x +c \right )\right )}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}\) | \(175\) |
risch | \(-\frac {x}{2 i a b -a^{2}+b^{2}}-\frac {4 i a b x}{a^{4}+2 a^{2} b^{2}+b^{4}}-\frac {4 i a b c}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}-\frac {2 i b^{2}}{\left (-i a +b \right ) d \left (i a +b \right )^{2} \left (b \,{\mathrm e}^{2 i \left (d x +c \right )}+i a \,{\mathrm e}^{2 i \left (d x +c \right )}-b +i a \right )}+\frac {2 a b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right )}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}\) | \(182\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.51, size = 131, normalized size = 1.60 \begin {gather*} \frac {\frac {2 \, a b \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} - \frac {a b \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {{\left (a^{2} - b^{2}\right )} {\left (d x + c\right )}}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} - \frac {b}{a^{3} + a b^{2} + {\left (a^{2} b + b^{3}\right )} \tan \left (d x + c\right )}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.86, size = 154, normalized size = 1.88 \begin {gather*} -\frac {b^{3} - {\left (a^{3} - a b^{2}\right )} d x - {\left (a b^{2} \tan \left (d x + c\right ) + a^{2} b\right )} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) - {\left (a b^{2} + {\left (a^{2} b - b^{3}\right )} d x\right )} \tan \left (d x + c\right )}{{\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} d \tan \left (d x + c\right ) + {\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [C] Result contains complex when optimal does not.
time = 0.72, size = 1260, normalized size = 15.37 \begin {gather*} \begin {cases} \frac {\tilde {\infty } x}{\tan ^{2}{\left (c \right )}} & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {x}{a^{2}} & \text {for}\: b = 0 \\- \frac {d x \tan ^{2}{\left (c + d x \right )}}{4 b^{2} d \tan ^{2}{\left (c + d x \right )} - 8 i b^{2} d \tan {\left (c + d x \right )} - 4 b^{2} d} + \frac {2 i d x \tan {\left (c + d x \right )}}{4 b^{2} d \tan ^{2}{\left (c + d x \right )} - 8 i b^{2} d \tan {\left (c + d x \right )} - 4 b^{2} d} + \frac {d x}{4 b^{2} d \tan ^{2}{\left (c + d x \right )} - 8 i b^{2} d \tan {\left (c + d x \right )} - 4 b^{2} d} - \frac {\tan {\left (c + d x \right )}}{4 b^{2} d \tan ^{2}{\left (c + d x \right )} - 8 i b^{2} d \tan {\left (c + d x \right )} - 4 b^{2} d} + \frac {2 i}{4 b^{2} d \tan ^{2}{\left (c + d x \right )} - 8 i b^{2} d \tan {\left (c + d x \right )} - 4 b^{2} d} & \text {for}\: a = - i b \\- \frac {d x \tan ^{2}{\left (c + d x \right )}}{4 b^{2} d \tan ^{2}{\left (c + d x \right )} + 8 i b^{2} d \tan {\left (c + d x \right )} - 4 b^{2} d} - \frac {2 i d x \tan {\left (c + d x \right )}}{4 b^{2} d \tan ^{2}{\left (c + d x \right )} + 8 i b^{2} d \tan {\left (c + d x \right )} - 4 b^{2} d} + \frac {d x}{4 b^{2} d \tan ^{2}{\left (c + d x \right )} + 8 i b^{2} d \tan {\left (c + d x \right )} - 4 b^{2} d} - \frac {\tan {\left (c + d x \right )}}{4 b^{2} d \tan ^{2}{\left (c + d x \right )} + 8 i b^{2} d \tan {\left (c + d x \right )} - 4 b^{2} d} - \frac {2 i}{4 b^{2} d \tan ^{2}{\left (c + d x \right )} + 8 i b^{2} d \tan {\left (c + d x \right )} - 4 b^{2} d} & \text {for}\: a = i b \\\frac {x}{\left (a + b \tan {\left (c \right )}\right )^{2}} & \text {for}\: d = 0 \\\frac {a^{3} d x}{a^{5} d + a^{4} b d \tan {\left (c + d x \right )} + 2 a^{3} b^{2} d + 2 a^{2} b^{3} d \tan {\left (c + d x \right )} + a b^{4} d + b^{5} d \tan {\left (c + d x \right )}} + \frac {a^{2} b d x \tan {\left (c + d x \right )}}{a^{5} d + a^{4} b d \tan {\left (c + d x \right )} + 2 a^{3} b^{2} d + 2 a^{2} b^{3} d \tan {\left (c + d x \right )} + a b^{4} d + b^{5} d \tan {\left (c + d x \right )}} + \frac {2 a^{2} b \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )}}{a^{5} d + a^{4} b d \tan {\left (c + d x \right )} + 2 a^{3} b^{2} d + 2 a^{2} b^{3} d \tan {\left (c + d x \right )} + a b^{4} d + b^{5} d \tan {\left (c + d x \right )}} - \frac {a^{2} b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{a^{5} d + a^{4} b d \tan {\left (c + d x \right )} + 2 a^{3} b^{2} d + 2 a^{2} b^{3} d \tan {\left (c + d x \right )} + a b^{4} d + b^{5} d \tan {\left (c + d x \right )}} - \frac {a^{2} b}{a^{5} d + a^{4} b d \tan {\left (c + d x \right )} + 2 a^{3} b^{2} d + 2 a^{2} b^{3} d \tan {\left (c + d x \right )} + a b^{4} d + b^{5} d \tan {\left (c + d x \right )}} - \frac {a b^{2} d x}{a^{5} d + a^{4} b d \tan {\left (c + d x \right )} + 2 a^{3} b^{2} d + 2 a^{2} b^{3} d \tan {\left (c + d x \right )} + a b^{4} d + b^{5} d \tan {\left (c + d x \right )}} + \frac {2 a b^{2} \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )} \tan {\left (c + d x \right )}}{a^{5} d + a^{4} b d \tan {\left (c + d x \right )} + 2 a^{3} b^{2} d + 2 a^{2} b^{3} d \tan {\left (c + d x \right )} + a b^{4} d + b^{5} d \tan {\left (c + d x \right )}} - \frac {a b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{a^{5} d + a^{4} b d \tan {\left (c + d x \right )} + 2 a^{3} b^{2} d + 2 a^{2} b^{3} d \tan {\left (c + d x \right )} + a b^{4} d + b^{5} d \tan {\left (c + d x \right )}} - \frac {b^{3} d x \tan {\left (c + d x \right )}}{a^{5} d + a^{4} b d \tan {\left (c + d x \right )} + 2 a^{3} b^{2} d + 2 a^{2} b^{3} d \tan {\left (c + d x \right )} + a b^{4} d + b^{5} d \tan {\left (c + d x \right )}} - \frac {b^{3}}{a^{5} d + a^{4} b d \tan {\left (c + d x \right )} + 2 a^{3} b^{2} d + 2 a^{2} b^{3} d \tan {\left (c + d x \right )} + a b^{4} d + b^{5} d \tan {\left (c + d x \right )}} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.47, size = 159, normalized size = 1.94 \begin {gather*} \frac {\frac {2 \, a b^{2} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{4} b + 2 \, a^{2} b^{3} + b^{5}} - \frac {a b \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {{\left (a^{2} - b^{2}\right )} {\left (d x + c\right )}}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} - \frac {2 \, a b^{2} \tan \left (d x + c\right ) + 3 \, a^{2} b + b^{3}}{{\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} {\left (b \tan \left (d x + c\right ) + a\right )}}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.08, size = 121, normalized size = 1.48 \begin {gather*} \frac {2\,a\,b\,\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}{d\,{\left (a^2+b^2\right )}^2}-\frac {b}{d\,\left (a^2+b^2\right )\,\left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )}{2\,d\,\left (-a^2\,1{}\mathrm {i}+2\,a\,b+b^2\,1{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,d\,\left (-a^2+a\,b\,2{}\mathrm {i}+b^2\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________